package com.fenghongzhang.day009;

import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class MySqlHelp2 extends SQLiteOpenHelper {


    public MySqlHelp2(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    /**
     * 1次
     * @param db
     */
    @Override
    public void onCreate(SQLiteDatabase db) {
        db.beginTransaction();
        db.execSQL( "create table person(id integer primary key autoincrement,name varchar(20))");

        db.setTransactionSuccessful();
        db.endTransaction();

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
